﻿@using KRM.Core
@model tblEmail
@{
    var listConversion = ViewBag.ListConversion as List<tblEmail>;
    var listAttachment = ViewBag.ListFileAttachments as List<tblEmailTicketAttachment>;
    var convertsionAttachments = ViewBag.ConvertsionAttachments as Dictionary<int, List<tblEmailTicketAttachment>>;
 }
 
<div id="ViewReplyEmail" class="modal fade" tabindex="-1" data-width="800">
            <div style="height: 2000px">
                <div style="height: 2000px"></div>
                <div class="ajax-loading"></div>
            </div>
</div>
<div id="CreateTicket" class="modal fade" tabindex="-1" data-width="800">
            <div style="height: 500px">
                <div style="height: 220px"></div>
                <div class="ajax-loading"></div>
            </div>
</div>
<div id="LinkToTicket" class="modal fade" tabindex="-1" data-width="1000">
    <div style="height: 500px">
        <div style="height: 220px"></div>
        <div class="ajax-loading"></div>
    </div>
</div>
<div id="CreateTaskModal" class="modal fade" tabindex="-1" data-width="800">
            <div style="height: 500px">
                <div style="height: 220px"></div>
                <div class="ajax-loading"></div>
            </div>
</div>

<input type="hidden" name="ID" value="@Model.EmailID"/>
@Html.Partial("Partial/_MessageResult")

<div class="span5" style="margin-top: 10px;"></div>

<div class="panel panel-default">
    <div class="panel-heading">

    <div class="row-fluid">
        <div class="span3">
            From: @Model.From 
            <a onclick="javascript:return confirm('Are you sure?');" class="btn red" style="float:right;margin-top:5px;margin-right:5px;" data-toggle="modal" href="/EmailTicket/SetReadLater/@Model.EmailID">Read later</a>                
            <a onclick="LinkToTicket(@Model.EmailID) " class="btn blue" style="float:right;margin-top:5px;margin-right:5px;" data-toggle="modal" href="#LinkToTicket">Link to ticket</a>
            <a onclick="CreateTicket(@Model.EmailID) " class="btn green" style="float:right;margin-top:5px;margin-right:5px;" data-toggle="modal" href="#CreateTicket">Create ticket</a>
            <a onclick="CreateTask(@Model.EmailID) " class="btn green" style="float:right;margin-top:5px;margin-right:5px;" data-toggle="modal" href="#">Create task</a>
            <a onclick="ViewReplyEmail(@Model.EmailID) " class="btn btn-info" style="float:right; margin-top:5px;margin-right:5px;" data-toggle="modal" href="#ViewReplyEmail">Reply</a>
        </div>
    </div>     
    <div class="row-fluid">
        <div class="span3">To: @Model.To
        </div>        
    </div>
     <div class="row-fluid">
        <div class="span3">CC: @Model.Cc</div>        
    </div>
     <div class="row">
        <div class="col-md-9"><label style="font-size:17px;">@Model.Subject</label>
         </div>   
         <div class="col-md-3">  
             <div class="row">
                 <div class="col-md-4">
             <label style="margin-right:15px;" >Attachments:</label>  </div>  
              <div class="col-md-8">      
                  @foreach (var item in listAttachment)
                    { 
                       <a style="" href="/EmailTicket/GetFileAttachment/@item.AttachmentID" class="row"> @item.Filename.Split('\\')[@item.Filename.Split('\\').Count() - 1]</a>
                    }
              </div>
              </div>       
          </div>      
    </div>   
    </div>
        <br />
    <div class="row-fluid panel-body">
        <div class="">
            @Html.Raw(@Model.Body)
            <form action="/EmailTicket/EmailDetails" method="POST" class="row-fluid fr-linktoticket123">            
            </form>
        </div>    
   </div>    
</div>

<hr />
<div class="portlet alert">
    <div class="portlet-title">
        <div class="caption"><i class="icon-comments-alt" style="font-size: 16px"></i>Conversion History</div>
        <div class="tools">
            <a href="javascript:;" class="collapse"></a>
        </div>
    </div>
    <div class="portlet-body">
        <div class="row">  
            @foreach (var item in listConversion)
            {
                <div class="col-md-12">
                    @if (item.IsIncommingEmail != true)
                    {
                        <div style="float:right; width:650px;" class="panel panel-info">
                            <div class="panel-heading">
                                <div class="span3">From: @item.From <label style="float:right">@item.Date</label></div>
                                To: @item.To<br />
                                Subject: @item.Subject
                            </div>
                            <div class="panel-body">@Html.Raw(@item.Body)</div>
                        </div>
                    }
                    else
                    {
                        <div style="float:left; width:650px;" class="panel panel-success">
                            <div class="panel-heading">
                                <div class="span3">From: @item.From <label style="float:right">@item.Date</label></div>
                                To: @item.To<br />
                                Subject: @item.Subject </div>
                            <div class="panel-body">@Html.Raw(@item.Body)</div>
                        </div>
                    }
                </div>
            }
        </div>    
    </div>
</div>

   
